home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / 4dtnt.zip / NOLTR.DOC < prev    next >
Text File  |  1991-11-03  |  2KB  |  56 lines

  1. The purpose of this section is to achieve independence from drive letters.
  2. Besides not having to remember drive letters, this allows me to reorganize
  3. my logical drives to take best advantage of free space as I like without
  4. having to edit any batch files or aliases.
  5.  
  6. Directory names cannot duplicate, however.  This is usually not a problem
  7. if your directory names are meaningful.
  8.  
  9. The first ingredient is a CDPATH set to run through all your hard drives.
  10. Here's how it is on my system:
  11.  
  12. CDPATH=C:\;D:\;E:\;F:\;G:\;H:\;I:\;J:\
  13.  
  14. Note the use of the ":\" to make sure we always start from the root looking
  15. for directories.
  16.  
  17.  
  18.                           ALIASES
  19.  
  20. Thanks to Tom Rawson for the key alias ("in") in this section.
  21.  
  22. IN=pushd %1^%2&^popd
  23. TAP=in tapcis tapcis q%&
  24. TC=in tc procomm
  25.  
  26. The "IN" alias does a "pushd" to save the current drive and directory. PUSHD
  27. also walks down the CDPATH looking for a directory name match on the first
  28. word after "IN".  Upon arrival, the remainder of the command line is executed.
  29.  
  30. When the application program exits, POPD takes you back where you started.
  31.  
  32. This is how I keep my PATH environment variable so short (see AUTOEXEC.ZIP).
  33. None of my utilities, no matter how stupidly written, need to have the PATH
  34. variable include their directories.  The CDPATH setup keeps me from needing
  35. to know drive letters.
  36.  
  37. Note, too, that this little trick can clean up a lot of junky little batch
  38. files that just change directory to the application and run it.
  39.  
  40.  
  41.                       FINDING DATA FILES
  42.  
  43. Here's a batch fragment that figures out where a file is to copy for further
  44. processing.  The same trick can be used in a number of ways to find a data
  45. directory without too much trouble.
  46.  
  47. pushd tackett
  48. set dr=%@substr[%_cwd,0,2]
  49. popd
  50.  
  51. After this fragment runs, the value of environment variable "dr" is equal
  52. to the letter of the drive containing directory "tackett" and the trailing
  53. colon (because the length argument to @substr = 2).  "Dr" is used elsewhere
  54. in the batch file to tell the application where its data is.
  55.  
  56.